Improve MtlsPopTokenNotSupportedinImdsV1 error message clarity#5908
Open
Improve MtlsPopTokenNotSupportedinImdsV1 error message clarity#5908
Conversation
…nd user-friendly Agent-Logs-Url: https://github.com/AzureAD/microsoft-authentication-library-for-dotnet/sessions/ccb50df4-2634-46bc-8072-d52f91b35139 Co-authored-by: gladjohn <90415114+gladjohn@users.noreply.github.com>
Agent-Logs-Url: https://github.com/AzureAD/microsoft-authentication-library-for-dotnet/sessions/ccb50df4-2634-46bc-8072-d52f91b35139 Co-authored-by: gladjohn <90415114+gladjohn@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Improve MtlsPopTokenNotSupportedinImdsV1 error message
Improve MtlsPopTokenNotSupportedinImdsV1 error message clarity
Apr 6, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
Updates the MtlsPopTokenNotSupportedinImdsV1 error message to replace internal “IMDSv1” jargon with a more plain-language, user-facing explanation about preview status and VM/image support.
Changes:
- Updated
MsalErrorMessage.MtlsPopTokenNotSupportedinImdsV1string to a clearer, more actionable message for end users.
gladjohn
approved these changes
Apr 6, 2026
Robbie-Microsoft
approved these changes
Apr 9, 2026
bgavrilMS
reviewed
Apr 10, 2026
| public const string InvalidCertificate = "The certificate received from the Imds server is invalid."; | ||
| public const string CannotSwitchBetweenImdsVersionsForPreview = "ImdsV2 is currently experimental - A Bearer token has already been received; Please restart the application to receive a mTLS PoP token."; | ||
| public const string MtlsPopTokenNotSupportedinImdsV1 = "A mTLS PoP token cannot be requested because the application\'s source was determined to be ImdsV1."; | ||
| public const string MtlsPopTokenNotSupportedinImdsV1 = "mTLS Proof of Possession with managed identity is currently in private preview and is not supported on this VM. Ensure you're running on a supported VM image."; |
Member
There was a problem hiding this comment.
Hmm, but this is a point in time state. In some N months it will not be in private preview.
How about creating an aka.ms link (can be to our wiki) and explaining more there? And here you just give a messgae saying "The VM doesn't currently support mTLS POP tokens. See https://aka.ms/msal/imdsv2 for details)"
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes - #5868
The error message for
MtlsPopTokenNotSupportedinImdsV1used internal jargon ("IMDSv1") that gave users no actionable information. Replaced it with a plain-language message that communicates the feature's preview status and the VM requirement.Changes proposed in this request
MsalErrorMessage.MtlsPopTokenNotSupportedinImdsV1: replaced opaque IMDSv1 reference with user-facing languageBefore:
After:
Testing
No test changes needed — existing tests assert only on the error code (
mtls_pop_token_not_supported_in_imds_v1), which is unchanged.Performance impact
None.
Documentation
Original prompt
Problem
The error message for
MtlsPopTokenNotSupportedinImdsV1is confusing because:Solution
Simplify the error message to:
Changes Required
MsalErrorMessage.cs- improve the error message constantThe following is the prior conversation context from the user's chat exploration (may be truncated):
User: how to fix this
Assistant: I can see you've shared an issue from the MSAL (Microsoft Authentication Library) repository about a confusing error message when acquiring bound tokens using System-Assigned Managed Identity.
Let me analyze this issue and provide guidance on how to fix it:
Assistant: Now let me find where this error is being thrown and how to fix it:
Assistant: Based on my investigation, the issue #5868 describes an unclear error message when a bound token request fails because the VM only supports IMDSv1 (Instance Metadata Service v1), but the application is trying to use IMDSv2 with mTLS Proof of Possession (PoP).
Problem Summary
Current error:
The message is confusing because:
How to Fix
The solution is to improve the error message in
MsalErrorMessage.csto be more actionable. Here's what needs to change:Key Improvements
Implementation
The error is thrown in two places:
ImdsV2ManagedIdentitySource.cs(line ~90) — When/getplatformmetadataendpoint returns 404ManagedIdentityClient.cs(line ~130) — When source is ImdsV1 but mTLS PoP is requestedBoth locations use the same error constant from
MsalErrorMessage.cs, so updating that one constant fixes both code paths.Would you like me to create a pull request with this fix?
User: the feature is still not in GA and in priuvate preview, the VM you are runing may nmot support reh feature
Assistant: You're absolutely right. Looking at the code and documentation more carefully, I can see this is still in private preview (as noted in the constraint table in the docs).
The real issue is that the error message should clarify:
Here's a better error message that accounts for the preview status:
Key additions:
Would you like me to create a PR with this improved me...
This pull request was created from Copilot chat.